import request from '@/utils/request'

// 用户个人档案相关API

// 创建个人档案
export function createProfile(data) {
  return request({
    url: '/dating/member',
    method: 'post',
    data: data
  })
}

// 检查手机号码是否已注册
export function checkPhoneExists(phone) {
  return request({
    url: '/dating/member/checkPhoneUnique',
    method: 'get',
    params: {
      phone: phone,
      memberId: null
    }
  })
}

// 获取当前用户的档案信息
export function getCurrentProfile() {
  return request({
    url: '/dating/profile/current',
    method: 'get'
  })
}

// 更新个人档案
export function updateProfile(data) {
  return request({
    url: '/dating/profile',
    method: 'put',
    data: data
  })
}

// 上传头像
export function uploadAvatar(file) {
  const formData = new FormData()
  formData.append('file', file)
  return request({
    url: '/dating/profile/avatar',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 获取个人档案状态
export function getProfileStatus() {
  return request({
    url: '/dating/profile/status',
    method: 'get'
  })
}

// 验证个人档案信息
export function validateProfile(data) {
  return request({
    url: '/dating/profile/validate',
    method: 'post',
    data: data
  })
}